package com.zzyl.controller.customer;

import com.zzyl.base.PageResponse;
import com.zzyl.base.ResponseResult;
import com.zzyl.controller.BaseController;
import com.zzyl.service.NursingProjectService;
import com.zzyl.vo.NursingProjectVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Api(tags = "")
@RestController
@RequestMapping("/customer/orders")
public class CusntomerOrderController  extends BaseController {
    @Autowired
    private NursingProjectService nursingProjectService;

    /**
     * 分页查询护理项目信息
     * @param name
     * @param status
     * @param pageNum
     * @param pageSize
     * @return
     */
    @ApiOperation(value = "分页查询护理项目信息")
    @GetMapping("project/page")
    public ResponseResult<PageResponse<NursingProjectVo>> queryPage(String name,
                                                                    Integer status,
                                                                    @ApiParam(name = "pageNum", value = "当前页码")
                                                                        @RequestParam(required = false, defaultValue = "1") Integer pageNum,
                                                                    @ApiParam(name = "pageSize", value = "总条数")
                                                                        @RequestParam(required = false, defaultValue = "10") Integer pageSize ){

        PageResponse<NursingProjectVo> vo = nursingProjectService.pageQuery(name, status, pageNum, pageSize);
        return  success(vo);

    }

    /**
     * 根据id查询护理项目信息
     * @param id
     * @return
     */
    @ApiOperation(value = "根据id查询护理项目信息")
    @GetMapping("project/{id}")
    public  ResponseResult<NursingProjectVo> queryById(@PathVariable Integer id){

        NursingProjectVo vo = nursingProjectService.getNursingProjectById(Long.valueOf(id));
        return success(vo);
    }


}
